home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / src / examples / stat.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-31  |  425 b   |  17 lines  |  [TEXT/R*ch]

  1. #include <stdlib.h>
  2. #include <iomanip.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5.  
  6. main(int argc, char **argv)
  7.         {
  8.         char name[99];
  9.         struct stat statbuf;
  10.         strcpy(name, argv[argc-1]);
  11.         if (stat(name, &statbuf)) perror(name),exit(-2);
  12.         cout << "File size = "; 
  13.         cout << dec  << statbuf.st_size << " bytes(" ;
  14.         cout << hex  << statbuf.st_size << " hex)" ;
  15.         cout << endl;
  16.         }
  17.